package com.lznb.cloud.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.lznb.cloud.utils.IsQuery;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;


/**
 * 新闻表
 *
 * @author mzy
 * @email 1992lcg@163.com
 * @date ${datetime}
 */
@Entity
@Table(name = "NEWS")
public class News implements Serializable {
    private static final long serialVersionUID = 1L;

    //新闻ID
    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    private String newsId;

    //新闻标题
    @IsQuery
    private String newsTitle;

    //标题图片
    private String newsPic;

    //新闻内容
    private String newsContent;
    //新闻摘要
    private String newsSummary;

    public String getNewsSummary() {
        return newsSummary;
    }

    public void setNewsSummary(String newsSummary) {
        this.newsSummary = newsSummary;
    }

    //发布时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date newsPublishtime;

    //浏览次数
    private Integer newsReadingnumber;

    //评论条数
    private Integer newsCommentcount;


    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    private String userId;


    @ManyToOne
    @JoinColumn(name = "category_id")
    private NewsCategory category;




    //更新时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    //排序
    private Integer newsSort;

    public NewsCategory getCategory() {
        return category;
    }

    public void setCategory(NewsCategory category) {
        this.category = category;
    }

    /**
     * 设置：新闻ID
     */
    public void setNewsId(String newsId) {
        this.newsId = newsId;
    }

    /**
     * 获取：新闻ID
     */
    public String getNewsId() {
        return newsId;
    }

    /**
     * 设置：新闻标题
     */
    public void setNewsTitle(String newsTitle) {
        this.newsTitle = newsTitle;
    }

    /**
     * 获取：新闻标题
     */
    public String getNewsTitle() {
        return newsTitle;
    }

    /**
     * 设置：标题图片
     */
    public void setNewsPic(String newsPic) {
        this.newsPic = newsPic;
    }

    /**
     * 获取：标题图片
     */
    public String getNewsPic() {
        return newsPic;
    }

    /**
     * 设置：新闻内容
     */
    public void setNewsContent(String newsContent) {
        this.newsContent = newsContent;
    }

    /**
     * 获取：新闻内容
     */
    public String getNewsContent() {
        return newsContent;
    }

    /**
     * 设置：发布时间
     */
    public void setNewsPublishtime(Date newsPublishtime) {
        this.newsPublishtime = newsPublishtime;
    }

    /**
     * 获取：发布时间
     */
    public Date getNewsPublishtime() {
        return newsPublishtime;
    }

    /**
     * 设置：浏览次数
     */
    public void setNewsReadingnumber(Integer newsReadingnumber) {
        this.newsReadingnumber = newsReadingnumber;
    }

    /**
     * 获取：浏览次数
     */
    public Integer getNewsReadingnumber() {
        return newsReadingnumber;
    }

    /**
     * 设置：评论条数
     */
    public void setNewsCommentcount(Integer newsCommentcount) {
        this.newsCommentcount = newsCommentcount;
    }

    /**
     * 获取：评论条数
     */
    public Integer getNewsCommentcount() {
        return newsCommentcount;
    }


    /**
     * 设置：更新时间
     */
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    /**
     * 获取：更新时间
     */
    public Date getUpdateTime() {
        return updateTime;
    }

    public Integer getNewsSort() {
        return newsSort;
    }

    public void setNewsSort(Integer newsSort) {
        this.newsSort = newsSort;
    }
}
